import hyRequest from '@/service'

export const useListMock = [
  {
    id: 1,
    name: '张三',
    realName: '张三',
    cellPhone: 18812345678,
    enable: 1,
    departmentId: 1,
    roleId: 1,
    createAt: '2021-01-02T10:20:26.000',
    updateAt: '2021-01-03T04:50:13.000Z'
  }
]

export function postUserListData() {
  return hyRequest.post({
    url: '/user/list',
    data: {
      pageIndex: 1,
      pageSize: 10
    }
  })
}

export function postUserListDataMock(info: { size: number; offset: number }) {
  console.log('info: ', info)
  return Promise.resolve({
    code: 0,
    data: {
      totalCount: 100,
      offset: 0,
      size: 10,
      list: useListMock
    }
  })
}

export interface IUser {
  userName: string
  email?: string
}
export function addUser(user: IUser) {
  return hyRequest.post({
    url: '/user',
    data: user
  })
}
